package com.zcgame.base.net

import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkInfo

/**
 *@author:huangLJ
 *@date:2021/4/29 11:38
 */
@Suppress("DEPRECATION")
object SystemUtils {
    //得传appcation的context，不然容易内存泄漏
    fun checkNetWork(context: Context):Boolean{
        val conn = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
        val net = conn.activeNetworkInfo
        if (net != null && net.isConnected) {
            return true
        }
        return false
    }
}